package com.nursing.controller.Elder;

import com.github.pagehelper.PageInfo;
import com.nursing.bean.CarePlan;
import com.nursing.model.Result;
import com.nursing.model.dto.CarePlanDto;
import com.nursing.model.dto.CareTaskDto;
import com.nursing.model.vo.admin.CreatePlan;
import com.nursing.service.PlanService;
import org.springframework.web.bind.annotation.*;

import java.time.LocalDateTime;
import java.util.List;

@RestController
@RequestMapping("/elderPlan")
public class ElderCarePlanController {

    private final PlanService planService;

    public ElderCarePlanController(PlanService planService) {
        this.planService = planService;
    }


    @GetMapping("/getPlanList")
    public Result<PageInfo<CarePlanDto>> getPlanList(@RequestParam(defaultValue = "1") int page, @RequestParam(defaultValue = "10")int size) {
        return Result.success(planService.list(page, size));
    }

    @DeleteMapping("/deletePlan")
    public Result<CarePlan> deletePlan(@RequestParam Integer id) {
        planService.deletePlan(id);
        return Result.success("删除成功");
    }
}
